package com.yunhe.tianhe.rentcars.service.cheliangguanli.impl;

import com.yunhe.tianhe.commons.dto.Pageable;
import com.yunhe.tianhe.rentcars.dao.cheliangguanli.WeiXiuDao;
import com.yunhe.tianhe.rentcars.entity.cheliangguanli.WeiXiu;
import com.yunhe.tianhe.rentcars.service.cheliangguanli.WeiXiuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.List;

@Service
public class WeiXiuServiceImpl implements WeiXiuService {

    private Pageable<WeiXiu> pageable=new Pageable<>();
    @Autowired
    private WeiXiuDao weiXiuDao;
    @Override
   @ResponseBody
    public Pageable findPage(Integer offset, Integer limit, String carcode, Date usecartime,Date returntime) {
        List<WeiXiu> list = weiXiuDao.findPage1(offset,limit,carcode,usecartime,returntime);
        int i = weiXiuDao.findPage2();
        pageable.setRows(list);
        pageable.setTotal(Long.valueOf(i));
        return pageable;
    }

    @Override
    public void save(WeiXiu weiXiu) {
         weiXiuDao.save(weiXiu);
    }
}
